<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

	<xsl:include href="../../header.xsl"/>
	<xsl:include href="../../footer.xsl"/>
	<xsl:include href="display_ead_generic.xsl"/>

	<xsl:param name="exist-url"/>
	<xsl:param name="id" select="descendant::c/@id"/>
	<xsl:param name="q"/>
	<xsl:param name="start"/>
	<xsl:param name="mode"/>
	<xsl:param name="image"/>
	<xsl:param name="side"/>
	<xsl:param name="display_path">
		<xsl:if test="not(string($mode))">
			<xsl:text>../../</xsl:text>
		</xsl:if>
	</xsl:param>

	<!-- path to javascript, images, search results, etc. should be ../../ from this path.  display_path param not necessary for any files gathered from the ajax-driven compare mode -->


	<xsl:param name="eadheader_url">
		<xsl:value-of select="document(concat($exist-url, '/site_info.xml'))//eadheader_url"/>
	</xsl:param>
	<xsl:param name="archdesc_did_url">
		<xsl:value-of select="document(concat($exist-url, '/site_info.xml'))//archdesc_did_url"/>
	</xsl:param>

	<xsl:param name="doc_id">
		<xsl:value-of select="document($eadheader_url)//eadid"/>
	</xsl:param>
	<xsl:param name="agency_text">
		<xsl:value-of select="document($eadheader_url)//publisher"/>
	</xsl:param>
	<xsl:param name="title">
		<xsl:value-of select="normalize-space(descendant::node()[@id=$id]/did/unittitle)"/>
	</xsl:param>
	<xsl:param name="accession">
		<xsl:value-of select="normalize-space(descendant::node()[@id=$id]/did/unitid)"/>
	</xsl:param>
	<xsl:param name="date">
		<xsl:value-of select="normalize-space(descendant::node()[@id=$id]/did/unitdate)"/>
	</xsl:param>
	<xsl:param name="source">
		<xsl:text>ead</xsl:text>
	</xsl:param>

	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="$mode='compare'">
				<xsl:apply-templates select="descendant::c[@level='item']"/>
				<script type="text/javascript" language="javascript" src="javascript/compare_back.js"/>
			</xsl:when>
			<xsl:otherwise>
				<html>
					<head>
						<link rel="stylesheet" type="text/css"
							href="http://yui.yahooapis.com/2.8.2r1/build/grids/grids-min.css"/>
						<link rel="stylesheet" type="text/css"
							href="http://yui.yahooapis.com/2.8.2r1/build/reset-fonts-grids/reset-fonts-grids.css"/>
						<link rel="stylesheet" type="text/css"
							href="http://yui.yahooapis.com/2.8.2r1/build/base/base-min.css"/>
						<link rel="stylesheet" type="text/css"
							href="http://yui.yahooapis.com/2.8.2r1/build/fonts/fonts-min.css"/>
						<!-- Core + Skin CSS -->
						<link rel="stylesheet" type="text/css"
							href="http://yui.yahooapis.com/2.8.2r1/build/menu/assets/skins/sam/menu.css"/>
						<link rel="stylesheet" type="text/css"
							href="http://yui.yahooapis.com/2.8.2r1/build/tabview/assets/skins/sam/tabview.css"/>

						<link type="text/css" href="{$display_path}style.css" rel="stylesheet"/>
						<script type="text/javascript" language="javascript" src="{$display_path}javascript/jquery-1.3.2.min.js"/>
						<script type="text/javascript" language="javascript" src="{$display_path}javascript/display_menu_tabs.js"/>
						<title>
							<xsl:value-of
								select="document(concat($exist-url, '/site_info.xml'))/site_info/title"/>
							<xsl:text>: </xsl:text>
							<xsl:text>Coin of </xsl:text>
							<xsl:value-of select="$title"/>
							<xsl:if test="string($date)">
								<xsl:text>, </xsl:text>
								<xsl:value-of select="$date"/>
							</xsl:if>
						</title>
					</head>
					<body class="yui-skin-sam">
						<div id="doc4" class="yui-t6">
							<xsl:call-template name="header"/>
							<div id="bd">
								<div id="yui-main">
									<xsl:apply-templates select="descendant::c[@level='item']"/>
								</div>
							</div>
							<xsl:call-template name="footer"/>
						</div>
					</body>
					<script type="text/javascript">
					var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
					document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
				</script>
					<script type="text/javascript">
					try {
					var pageTracker = _gat._getTracker("UA-5343246-4");
					pageTracker._trackPageview();
					} catch(err) {}</script>
				</html>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="c[@level='item']">
		<xsl:if test="$mode = 'compare'">
			<div class="compare_options">
				<a
					href="compare_results?q={$q}&amp;start={$start}&amp;image={$image}&amp;side={$side}&amp;mode=compare"
					class="back_results">« Search results</a>
				<xsl:text> | </xsl:text>
				<a href="display/{$source}/{$id}">Full record »</a>
			</div>
		</xsl:if>

		<!-- below is a series of conditionals for forming the image boxes and displaying obverse and reverse images, iconography, and legends if they are available within the EAD document -->
		<xsl:choose>
			<xsl:when test="not($mode = 'compare')">
				<div class="yui-g">
					<xsl:call-template name="print"/>
					<div class="yui-u first">
						<xsl:if
							test="string(did/daogrp/daoloc[@label='screen_obv']/@href) or string(did/physdesc/physfacet[@type='obverse_legend']) or string(did/physdesc/physfacet[@type='obverse_iconography'])">
							<div class="screen_image">
								<xsl:if test="did/daogrp/daoloc[@label='screen_obv']/@href">
									<img
										src="{$display_path}{did/daogrp/daoloc[@label='screen_obv']/@href}"
										alt="Obverse Image"/>
									<br/>
								</xsl:if>
								<xsl:if
									test="string(did/physdesc/physfacet[@type='obverse_legend']) or string(did/physdesc/physfacet[@type='obverse_iconography'])">
									<b>Obverse: </b>
								</xsl:if>
								<xsl:apply-templates
									select="did/physdesc/physfacet[@type='obverse_legend']"/>
								<xsl:if
									test="string(did/physdesc/physfacet[@type='obverse_legend']) and string(did/physdesc/physfacet[@type='obverse_iconography'])">
									<xsl:text> - </xsl:text>
								</xsl:if>
								<xsl:apply-templates
									select="did/physdesc/physfacet[@type='obverse_iconography']"/>
								<!--<xsl:if test="string(did/daogrp/daoloc[@label='master_obv']/@href)">
									<xsl:text> (</xsl:text>
									<a
										href="{$display_path}{did/daogrp/daoloc[@label='master_obv']/@href}"
										target="_blank">Full View</a>
									<xsl:text>)</xsl:text>
								</xsl:if>-->
							</div>
						</xsl:if>
						<xsl:if
							test="string(did/daogrp/daoloc[@label='screen_rev']/@href) or string(did/physdesc/physfacet[@type='reverse_legend']) or string(did/physdesc/physfacet[@type='reverse_iconography'])">
							<div class="screen_image">
								<xsl:if test="did/daogrp/daoloc[@label='screen_rev']/@href">
									<img
										src="{$display_path}{did/daogrp/daoloc[@label='screen_rev']/@href}"
										alt="reverse Image"/>
									<br/>
								</xsl:if>
								<xsl:if
									test="string(did/physdesc/physfacet[@type='reverse_legend']) or string(did/physdesc/physfacet[@type='reverse_iconography'])">
									<b>Reverse: </b>
								</xsl:if>
								<xsl:apply-templates
									select="did/physdesc/physfacet[@type='reverse_legend']"/>
								<xsl:if
									test="string(did/physdesc/physfacet[@type='reverse_legend']) and string(did/physdesc/physfacet[@type='reverse_iconography'])">
									<xsl:text> - </xsl:text>
								</xsl:if>
								<xsl:apply-templates
									select="did/physdesc/physfacet[@type='reverse_iconography']"/>
								<!--<xsl:if test="string(did/daogrp/daoloc[@label='master_rev']/@href)">
									<xsl:text> (</xsl:text>
									<a
										href="{$display_path}{did/daogrp/daoloc[@label='master_rev']/@href}"
										target="_blank">Full View</a>
									<xsl:text>)</xsl:text>
								</xsl:if>-->
							</div>
						</xsl:if>
					</div>
					<div class="yui-u">
						<h1>
							<xsl:value-of select="normalize-space(did/unittitle)"/>
							<xsl:if test="string(did/unitdate)">
								<xsl:text>, </xsl:text>
								<xsl:value-of select="normalize-space(did/unitdate)"/>
							</xsl:if>
						</h1>
						<xsl:call-template name="page_content"/>
					</div>
					<xsl:call-template name="print"/>
				</div>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if
					test="string(did/daogrp/daoloc[@label='screen_obv']/@href) or string(did/physdesc/physfacet[@type='obverse_legend']) or string(did/physdesc/physfacet[@type='obverse_iconography'])">
					<div class="screen_image">
						<xsl:if test="did/daogrp/daoloc[@label='screen_obv']/@href">
							<img src="{$display_path}{did/daogrp/daoloc[@label='screen_obv']/@href}"
								alt="Obverse Image"/>
							<br/>
						</xsl:if>
						<xsl:if
							test="string(did/physdesc/physfacet[@type='obverse_legend']) or string(did/physdesc/physfacet[@type='obverse_iconography'])">
							<b>Obverse: </b>
						</xsl:if>
						<xsl:apply-templates select="did/physdesc/physfacet[@type='obverse_legend']"/>
						<xsl:if
							test="string(did/physdesc/physfacet[@type='obverse_legend']) and string(did/physdesc/physfacet[@type='obverse_iconography'])">
							<xsl:text> - </xsl:text>
						</xsl:if>
						<xsl:apply-templates
							select="did/physdesc/physfacet[@type='obverse_iconography']"/>
					</div>
				</xsl:if>
				<xsl:if
					test="string(did/daogrp/daoloc[@label='screen_rev']/@href) or string(did/physdesc/physfacet[@type='reverse_legend']) or string(did/physdesc/physfacet[@type='reverse_iconography'])">
					<div class="screen_image">
						<xsl:if test="did/daogrp/daoloc[@label='screen_rev']/@href">
							<img src="{$display_path}{did/daogrp/daoloc[@label='screen_rev']/@href}"
								alt="reverse Image"/>
							<br/>
						</xsl:if>
						<xsl:if
							test="string(did/physdesc/physfacet[@type='reverse_legend']) or string(did/physdesc/physfacet[@type='reverse_iconography'])">
							<b>Reverse: </b>
						</xsl:if>
						<xsl:apply-templates select="did/physdesc/physfacet[@type='reverse_legend']"/>
						<xsl:if
							test="string(did/physdesc/physfacet[@type='reverse_legend']) and string(did/physdesc/physfacet[@type='reverse_iconography'])">
							<xsl:text> - </xsl:text>
						</xsl:if>
						<xsl:apply-templates
							select="did/physdesc/physfacet[@type='reverse_iconography']"/>
					</div>
				</xsl:if>
				<xsl:call-template name="page_content"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="page_content">
		<!--********************************* MENU ******************************************* -->
		<xsl:choose>
			<xsl:when test="$mode = 'compare'">
				<xsl:apply-templates select="did"/>
				<xsl:if test="phystech">
					<div class="metadata_section">
						<xsl:apply-templates select="phystech"/>
					</div>
				</xsl:if>
				<xsl:if test="bibliography">
					<div class="metadata_section">
						<xsl:apply-templates select="bibliography"/>
					</div>
				</xsl:if>
				<xsl:call-template name="archival_data"/>
			</xsl:when>
			<xsl:otherwise>
				<div id="demo" class="yui-navset">
					<ul class="yui-nav">
						<li class="selected" id="metadata_link">
							<a href="#tab1">
								<em>Summary</em>
							</a>
						</li>
						<xsl:if
							test="abstract or descgrp or bioghist or ancestor::node()[@level='series']/descgrp or ancestor::node()[@level='series']/bioghist">
							<li id="commentary_link">
								<a href="#tab2">
									<em>Commentary</em>
								</a>
							</li>
						</xsl:if>

					</ul>
					<div class="yui-content">
						<div id="metadata">

							<xsl:apply-templates select="did"/>

							<xsl:if test="phystech">
								<div class="metadata_section">
									<xsl:apply-templates select="phystech"/>
								</div>
							</xsl:if>
							<xsl:if test="bibliography">
								<div class="metadata_section">
									<xsl:apply-templates select="bibliography"/>
								</div>
							</xsl:if>

							<xsl:call-template name="archival_data"/>

							<xsl:if test="controlaccess">
								<div class="metadata_section">
									<xsl:apply-templates select="controlaccess"/>
								</div>
							</xsl:if>
						</div>
						<div id="commentary" class="hidden">
							<xsl:if
								test="abstract or descgrp or bioghist or ancestor::node()[@level='series']/descgrp or ancestor::node()[@level='series']/bioghist">
								<xsl:call-template name="toc"/>
								<xsl:apply-templates select="abstract"/>
								<xsl:apply-templates select="descgrp | bioghist"/>
								<xsl:apply-templates
									select="ancestor::node()[@level='series']/descgrp | ancestor::node()[@level='series']/bioghist"
								/>
							</xsl:if>
						</div>
					</div>
				</div>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>


	<!--******************************************* DID **************************************************-->
	<xsl:template match="did">
		<xsl:if
			test="string(unittitle/persname) or string(unitdate) or physdesc or string(materialspec[1])">
			<div class="metadata_section">
				<h3>Descriptive Information</h3>

				<dl>
					<xsl:if test="string(unittitle/persname)">
						<xsl:for-each select="unittitle/persname">
							<div>
								<dt>
									<b>
										<xsl:choose>
											<xsl:when test="@role">
												<xsl:value-of
												select="concat(upper-case(substring(@role, 1, 1)), substring(@role, 2))"
												/>: </xsl:when>
											<xsl:otherwise> Name: </xsl:otherwise>
										</xsl:choose>
									</b>
								</dt>
								<dd>
									<xsl:value-of select="."/>
									<xsl:if
										test="string(normalize-space(@normal)) and not(@normal='anonymous')"
										> (<xsl:value-of select="@normal"/>) </xsl:if>
								</dd>
							</div>
						</xsl:for-each>
					</xsl:if>
					<xsl:if test="string(unitdate)">
						<div>
							<dt>
								<b>Date:</b>
							</dt>
							<dd>
								<xsl:value-of select="unitdate"/>
							</dd>
						</div>
					</xsl:if>
					<xsl:if test="physdesc">
						<xsl:apply-templates select="physdesc"/>
					</xsl:if>
					<xsl:for-each
						select="materialspec[@type='department'] | materialspec[@type='script'] | materialspec[@type='era'] | materialspec[@type='degree'] | materialspec[@type='decoration']">
						<div>
							<dt>
								<b><xsl:value-of
										select="concat(upper-case(substring(@type, 1, 1)), substring(@type, 2))"
									/>: </b>
							</dt>
							<dd>
								<a
									href="{$display_path}results?q={@type}_facet:&#x0022;{normalize-space(.)}&#x0022;">
									<xsl:value-of select="normalize-space(.)"/>
								</a>
							</dd>
						</div>
					</xsl:for-each>
				</dl>
			</div>
		</xsl:if>
		<!-- call origination template -->
		<xsl:if test="origination">
			<div class="metadata_section">
				<h3>Mint</h3>
				<dl>
					<xsl:apply-templates select="origination"/>
				</dl>
			</div>
		</xsl:if>
	</xsl:template>


	<xsl:template match="physdesc">
		<xsl:if test="string(genreform[@type='format'])">
			<div>
				<dt>
					<b>Format: </b>
				</dt>
				<dd>
					<a
						href="{$display_path}results?q=format_facet:&#x0022;{normalize-space(genreform[@type='format'])}&#x0022;"
						style="text-transform:capitalize;">
						<xsl:value-of select="normalize-space(genreform[@type='format'])"/>
					</a>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='axis'])">
			<div>
				<dt>
					<b>Axis:</b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='axis']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='color'][1])">
			<div>
				<dt>
					<b>Color: </b>
				</dt>
				<dd>
					<xsl:for-each select="physfacet[@type='color']">
						<a href="{$display_path}results?q=color_facet:&#x0022;{.}&#x0022;"
							style="text-transform:capitalize;">
							<xsl:value-of select="."/>
						</a>
						<xsl:if test="not(position() = last())">
							<xsl:text>, </xsl:text>
						</xsl:if>
					</xsl:for-each>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='counterstamp'])">
			<div>
				<dt>
					<b>Counterstamp: </b>
				</dt>
				<dd>
					<xsl:for-each select="physfacet[@type='counterstamp']">
						<xsl:value-of select="."/>
						<xsl:if test="not(position() = last())">
							<xsl:text>, </xsl:text>
						</xsl:if>
					</xsl:for-each>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='dob'])">
			<div>
				<dt>
					<b>Date on Object: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='dob']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(genreform[@type='denomination'])">
			<div>
				<dt>
					<b>Denomination:</b>
				</dt>
				<dd>
					<xsl:for-each select="genreform[@type='denomination']">
						<a href="{$display_path}results?q=denomination_facet:&#x0022;{.}&#x0022;"
							style="text-transform:capitalize;">
							<xsl:value-of select="."/>
						</a>
						<xsl:if test="position() &gt; 0 and not(position() = last())">
							<xsl:text>, </xsl:text>
						</xsl:if>
					</xsl:for-each>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(dimensions)">
			<div>
				<dt>
					<b>Dimensions:</b>
				</dt>
				<dd>
					<xsl:value-of select="dimensions"/>
					<xsl:choose>
						<xsl:when test="dimensions/@unit">
							<xsl:text> </xsl:text>
							<xsl:value-of select="dimensions/@unit"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text> mm</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='edge'])">
			<div>
				<dt>
					<b>Edge: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='edge']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(function)">
			<div>
				<dt>
					<b>Function:</b>
				</dt>
				<dd>
					<xsl:for-each select="function">
						<xsl:value-of select="."/>
						<xsl:if test="position() &gt; 0 and not(position() = last())">
							<xsl:text>, </xsl:text>
						</xsl:if>
					</xsl:for-each>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='manufacture'])">
			<div>
				<dt>
					<b>Manufacture: </b>
				</dt>
				<dd>
					<a
						href="{$display_path}results?q=manufacture_facet:&#x0022;{physfacet[@type='manufacture']}&#x0022;">
						<xsl:value-of select="physfacet[@type='manufacture']"/>
					</a>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='material'])">
			<div>
				<dt>
					<b>Material:</b>
				</dt>
				<dd>
					<xsl:for-each select="physfacet[@type='material']">
						<a href="{$display_path}results?q=material_facet:&#x0022;{.}&#x0022;"
							style="text-transform:capitalize;">
							<xsl:value-of select="."/>
						</a>
						<xsl:if test="position() &gt; 0 and not(position() = last())">
							<xsl:text>, </xsl:text>
						</xsl:if>
					</xsl:for-each>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='netGrade'])">
			<div>
				<dt>
					<b>Net Grade: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='netGrade']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='obverseGrade'])">
			<div>
				<dt>
					<b>Obverse Grade: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='obverseGrade']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='obverseSymbol'])">
			<div>
				<dt>
					<b>Obverse Symbol: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='obverseSymbol']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='reverseGrade'])">
			<div>
				<dt>
					<b>Reverse Grade: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='reverseGrade']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='reverseSymbol'])">
			<div>
				<dt>
					<b>Reverse Symbol: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='reverseSymbol']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='sernum'])">
			<div>
				<dt>
					<b>Serial Number: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='sernum']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='shape'])">
			<div>
				<dt>
					<b>Shape: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='shape']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='signature'])">
			<div>
				<dt>
					<b>Signature: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='signature']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='symbol'])">
			<div>
				<dt>
					<b>Symbol: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='symbol']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='undertype'])">
			<div>
				<dt>
					<b>Undertype: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='undertype']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='watermark'])">
			<div>
				<dt>
					<b>Watermark: </b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='watermark']"/>
				</dd>
			</div>
		</xsl:if>
		<xsl:if test="string(physfacet[@type='weight'])">
			<div>
				<dt>
					<b>Weight:</b>
				</dt>
				<dd>
					<xsl:value-of select="physfacet[@type='weight']"/>
					<xsl:choose>
						<xsl:when test="physfacet[@type='weight']/@unit">
							<xsl:text> </xsl:text>
							<xsl:value-of select="physfacet[@type='weight']/@unit"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text> grams</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</dd>
			</div>
		</xsl:if>
	</xsl:template>

	<!--*******************ORIGINATION**********************************-->
	<xsl:template match="origination">
		<dl>
			<xsl:apply-templates select="persname | famname | corpname | geogname"/>
		</dl>
	</xsl:template>

	<!--********************************* END ORIGINATION ***************************-->


	<xsl:template match="phystech">
		<h3>Physical Characteristics</h3>

		<div class="phystech">
			<xsl:apply-templates/>
		</div>
	</xsl:template>


	<!--************************************** INDEX TERMS ************************************* -->

	<xsl:template match="controlaccess">
		<h3>Index Terms</h3>
		<xsl:if test="persname">
			<ul class="index_terms">
				<li>
					<h4>Personal Names:</h4>
				</li>
				<li>
					<dl>
						<xsl:apply-templates select="persname"/>
					</dl>
				</li>
			</ul>
		</xsl:if>
		<xsl:if test="famname">
			<ul class="index_terms">
				<li>
					<h4>Dynasty:</h4>
				</li>
				<li>
					<dl>
						<xsl:apply-templates select="famname"/>
					</dl>
				</li>
			</ul>
		</xsl:if>
		<xsl:if test="corpname">
			<ul class="index_terms">
				<li>
					<h4>Political Entities:</h4>
				</li>
				<li>
					<dl>
						<xsl:apply-templates select="corpname"/>
					</dl>
				</li>
			</ul>
		</xsl:if>
		<xsl:if test="geogname">
			<ul class="index_terms">
				<li>
					<h4>Geographical Locations:</h4>
				</li>
				<li>
					<dl>
						<xsl:apply-templates select="geogname"/>
					</dl>
				</li>
			</ul>
		</xsl:if>
		<xsl:if test="subject">
			<ul class="index_terms">
				<li>
					<h4>Subjects:</h4>
				</li>
				<li>
					<dl>
						<xsl:apply-templates select="subject"/>
					</dl>
				</li>
			</ul>
		</xsl:if>
	</xsl:template>
	<!--***************************************** END INDEX TERMS **************************************** -->
	<!--***************************************** ARCHIVAL DATA **************************************** -->
	<xsl:template name="archival_data">
		<div class="summary_section">
			<h3>Archival Data</h3>
			<dl>
				<div>
					<dt>
						<b>Institution:</b>
					</dt>
					<dd>
						<a
							href="{$display_path}results?q=institution_facet:&#x0022;{$agency_text}&#x0022;">
							<xsl:value-of select="$agency_text"/>
						</a>
					</dd>
				</div>
				<xsl:if test="ancestor::archdesc/did/repository and ancestor::archdesc/did/physloc">
					<div>
						<dt>
							<b>Intellectual Caretaker:</b>
						</dt>
						<dd>
							<xsl:value-of select="ancestor::archdesc/did/repository"/>
						</dd>
					</div>
					<div>
						<dt>
							<b>Physical Custodian:</b>
						</dt>
						<dd>
							<xsl:value-of select="ancestor::archdesc/did/physloc"/>
						</dd>
					</div>
				</xsl:if>
				<xsl:if
					test="ancestor::archdesc/did/repository and not(ancestor::archdesc/did/physloc)">
					<div>
						<dt>
							<b>Repository:</b>
						</dt>
						<dd>
							<xsl:value-of select="ancestor::archdesc/did/repository"/>
						</dd>
					</div>
				</xsl:if>
				<div>
					<dt>
						<b>Collection:</b>
					</dt>
					<dd>
						<a
							href="{$display_path}results?q=collection_facet:&#x0022;{document($archdesc_did_url)//unittitle}&#x0022;">
							<xsl:value-of select="document($archdesc_did_url)//unittitle"/>
						</a>
					</dd>
				</div>
				<xsl:if test="string(did/container)">
					<div>
						<dt>
							<b>Container:</b>
						</dt>
						<dd>
							<xsl:if test="string(did/container/@type)">
								<xsl:value-of select="did/container/@type"/>
								<xsl:text> </xsl:text>
							</xsl:if>
							<xsl:value-of select="did/container"/>
						</dd>
					</div>
				</xsl:if>
				<xsl:if test="string(did/unitid)">
					<div>
						<dt>
							<b>Accession Number:</b>
						</dt>
						<dd>
							<xsl:apply-templates select="did/unitid"/>
						</dd>
					</div>
				</xsl:if>
				<xsl:if test="string(did/physloc)">
					<div>
						<dt>
							<b>Physical location:</b>
						</dt>
						<dd>
							<xsl:apply-templates select="did/physloc"/>
						</dd>
					</div>
				</xsl:if>
			</dl>
		</div>
		<xsl:if
			test="custodhist or acqinfo or ancestor::archdesc/acqinfo or ancestor::c[@level='series']/acqinfo or ancestor::archdesc/custodhist or ancestor::c[@level='series']/custodhist or appraisal">
			<div class="summary_section">
				<h3>Administrative History</h3>
				<xsl:apply-templates select="custodhist"/>
				<xsl:apply-templates select="ancestor::c[@level='series']/custodhist"/>
				<xsl:apply-templates select="ancestor::archdesc/custodhist"/>
				<xsl:apply-templates select="acqinfo"/>
				<xsl:apply-templates select="ancestor::c[@level='series']/acqinfo"/>
				<xsl:apply-templates select="ancestor::archdesc/acqinfo"/>

				<xsl:if test="string(appraisal)">
					<div class="adminhist_div">
						<h4>Appraisal:</h4>
						<xsl:apply-templates select="appraisal"/>

					</div>
				</xsl:if>
			</div>
		</xsl:if>
	</xsl:template>
	<!--***************************************** END ARCHIVAL DATA **************************************** -->
	<!--***************************************** PERSNAME/FAMNAME/CORPNAME/GEOGNAME/SUBJECT **************************************** -->
	<xsl:template match="persname | famname | corpname | geogname | subject">
		<xsl:choose>
			<xsl:when test="parent::controlaccess or parent::origination">
				<div>
					<dt>
						<b>
							<xsl:choose>
								<xsl:when test="string(normalize-space(@role))">
									<xsl:value-of
										select="concat(upper-case(substring(@role, 1, 1)), substring(@role, 2))"
									/>: </xsl:when>
								<xsl:otherwise>
									<xsl:choose>
										<xsl:when test="name() = 'geogname'">Geographical
											Location:<xsl:text/></xsl:when>
										<xsl:when test="name() = 'subject'">
											<xsl:value-of
												select="if (string(@type)) then concat(upper-case(substring(@type, 1, 1)), substring(@type, 2), ':') else 'Subject:'"
											/>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>Name:</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</dt>
					<dd>
						<xsl:choose>
							<xsl:when test="parent::controlaccess">
								<xsl:variable name="field">
									<xsl:choose>
										<xsl:when test="name() = 'geogname'">
											<xsl:choose>
												<xsl:when test="string(normalize-space(@role))">
												<xsl:value-of
												select="concat(normalize-space(@role), '_facet')"
												/>
												</xsl:when>
												<xsl:otherwise>
												<xsl:text>geogname_text</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
										<xsl:when test="name() = 'subject'">
											<xsl:choose>
												<xsl:when test="string(@type)">
												<xsl:value-of
												select="concat(normalize-space(@type), '_facet')"
												/>
												</xsl:when>
												<xsl:otherwise>
												<xsl:text>subject_facet</xsl:text>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:when>
										<xsl:otherwise>
											<xsl:choose>
												<xsl:when
												test="@role='deity' or @role='artist' or @role='engraver' or @role='maker' or @role='issuer'">
												<xsl:value-of select="concat(@role, '_facet')"/>
												</xsl:when>
												<xsl:otherwise>
												<xsl:value-of select="concat(name(), '_facet')"/>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<a href="{$display_path}results?q={$field}:&#x0022;{.}&#x0022;">
									<xsl:value-of select="."/>
								</a>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="."/>
							</xsl:otherwise>
						</xsl:choose>
					</dd>
				</div>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="."/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--***************************************** END TERMS **************************************** -->
	<!--***************************************** OPTIONS BAR  (PRINT/PDF) **************************************** -->
	<xsl:template name="print">
		<div class="submenu">
			<div class="icon">
				<a href="{$display_path}display/{$source}/{$id}.pdf">
					<img src="{$display_path}images/pdficon.png" title="PDF" alt="PDF"/>
				</a>
			</div>
			<div class="icon">
				<a href="{$display_path}display/{$source}/{$id}.xml">
					<img src="{$display_path}images/xml.png" title="XML" alt="PDF"/>
				</a>
			</div>
			<div class="icon">
				<a href="{$display_path}display/{$source}/{$id}.rdf">
					<img src="{$display_path}images/rdf.gif" title="RDF" alt="PDF"/>
				</a>
			</div>
			<div class="icon">
				<a href="{$display_path}display/{$source}/{$id}.atom">
					<img src="{$display_path}images/atom.png" title="Atom" alt="Atom"/>
				</a>
			</div>
			<div class="icon">
				<!-- AddThis Button BEGIN -->
				<a href="http://www.addthis.com/bookmark.php?v=250&amp;pub=xa-4a6926fd3dde83e2"
					onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')"
					onmouseout="addthis_close()" onclick="return addthis_sendto()">
					<img src="http://s7.addthis.com/static/btn/lg-bookmark-en.gif" width="125"
						height="16" alt="Bookmark and Share" style="border:0"/>
				</a>
				<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=xa-4a6926fd3dde83e2"/>
				<!-- AddThis Button END -->
			</div>
		</div>
	</xsl:template>

</xsl:stylesheet>
